home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
msdos
/
plotting
/
pcgplots
/
gptmain.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-24
|
3KB
|
111 lines
// GPtMain - main for program
// copyright 1992 Pittsburgh Supercomputing Center
#include "gpt.h"
#include "new.h"
// Multiple Document "main"
// Application class statics
HANDLE Appl::hInstance = 0;
HANDLE Appl::hPrevInstance = 0;
int Appl::nCmdShow = 0;
LPSTR Appl::CmdParam = NULL;
HWND Appl::hWndClient = NULL;
HWND Appl::hWndFrame = NULL;
FrameWindowPt Appl::theFrame = NULL;
void newFail()
{
int i=1;
}
// Turn off warning: Parameter 'lpszCmdLine' is never used in function WinMain(unsigned int,unsigned int,char far*,int)
#pragma argsused
// Turn off warning aus- identifier MainWnd assigned value that is never used
#pragma option -w-aus
int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpszCmdLine,
int nCmdShow )
{
set_new_handler(newFail);
Appl::hInstance = hInstance;
Appl::hPrevInstance = hPrevInstance;
Appl::nCmdShow = nCmdShow;
Appl::CmdParam = new char[lstrlen(lpszCmdLine) + 1];
lstrcpy((LPSTR)Appl::CmdParam,lpszCmdLine);
if ( ! Appl::hPrevInstance )
{
FrameWindow::Register();
CGMWindow::Register();
WMetaWindow::Register();
}
FrameWindow::LoadAccelerators(Appl::hInstance);
FrameWindow::LoadMenu(Appl::hInstance);
CGMWindow::LoadMenu(Appl::hInstance);
//CGMWindow::LoadAccelerators(Appl::hInstance);
WMetaWindow::LoadMenu(Appl::hInstance);
Appl::theFrame = new FrameWindow; // fire constructor
int stat = Appl::theFrame->MessageLoop(); // and process messages
delete Appl::theFrame;
if (Appl::CmdParam) delete []Appl::CmdParam;
return stat;
}
// ********* WndProc
long FAR PASCAL _export WndProc( HWND hWnd, WORD iMessage,
WORD wParam, LONG lParam )
{
// Pointer to the (C++ object that is the) window.
Window *pWindow = GetPointer( hWnd ); // invalid value if WM_CREATE not
// yet processed
if ( pWindow == 0 )
{
if ( iMessage == WM_CREATE )
{
LPCREATESTRUCT lpcs;
lpcs = (LPCREATESTRUCT) lParam;
pWindow = (Window *) lpcs->lpCreateParams;
// Store a pointer to this object in the window's extra bytes;
SetPointer( hWnd, pWindow );
// Now let the object perform whatever initialization it
// needs for WM_CREATE in its own WndProc.
return pWindow->WndProc(hWnd, iMessage, wParam, lParam );
}
else
return DefFrameProc( hWnd, Appl::hWndClient,
iMessage, wParam, lParam );
}
else
return pWindow->WndProc( hWnd, iMessage, wParam, lParam );
}
// ***** gptWndProc
long FAR PASCAL _export gptWndProc( HWND hWnd, WORD iMessage,
WORD wParam, LONG lParam )
{
// Pointer to the (C++ object that is the) window.
Window *pWindow = GetPointer( hWnd ); // invalid value if WM_CREATE not
// yet processed
if ( pWindow == 0 )
{
if ( iMessage == WM_CREATE )
{
LPCREATESTRUCT lpcs;
LPMDICREATESTRUCT lpMDIcs;
lpcs = (LPCREATESTRUCT) lParam;
lpMDIcs = (LPMDICREATESTRUCT)lpcs->lpCreateParams;
//pWindow = (Window *) lpMDIcs->lParam;
pWindow = (Window *)GetObjectPt(lpMDIcs->lParam );
// Store a pointer to this object in the window's extra bytes;
SetPointer( hWnd, pWindow );
// Now let the object perform whatever initialization it
// needs for WM_CREATE in its own WndProc.
return pWindow->WndProc(hWnd, iMessage, wParam, lParam );
}
else
return DefMDIChildProc( hWnd, iMessage, wParam, lParam );
}
else
return pWindow->WndProc( hWnd, iMessage, wParam, lParam );
}